package com.yami.shop.config;

import com.yami.shop.common.bean.MeltCloudConfig;
import com.yami.shop.service.SysConfigService;
import io.rong.RongCloud;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * redis管理类
 *
 * @author terrfly
 * @date 2021-04-27 15:50
 */
@Configuration
@Data
public class RongCloudIMConfig {

//    private String appKey="pgyu6atqpsepu";
//
//    private String appSecret="YeAJrwSFK09M";
//    
//    private String portrait;

    @Autowired
    private SysConfigService sysConfigService;

    /**
     * 当前系统的融云IM操作对象
     */
    @Bean
    public RongCloud sysRongCloud() {
        MeltCloudConfig config = sysConfigService.getSysConfigObject("MELT_CLOUD_CONFIG", MeltCloudConfig.class);
        return RongCloud.getInstance(config.getAppKey(), config.getAppSecret());
    }

}
